package com.cykj.user.controller;

import com.cykj.common.dto.ResponseDTO;
import com.cykj.user.service.IOnlineResumeService;
import com.cykj.user.vo.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.lang.annotation.Target;
import java.util.List;

/**
 * @BelongsProject: smart_recruit_backend
 * @BelongsPackage: com.cykj.user.controller
 * @Author: 浮行
 * @CreateTime: 2025-08-21 10:34
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("/onlineResume")
public class OnlineResumeController {
    @Autowired
    private IOnlineResumeService onlineResumeService;
    //新增工作经历
    @PostMapping("/addWork")
    @Operation(summary = "新增工作经历")
    public ResponseDTO addWork(@RequestBody WorkHistoryVO workHistoryVO){
        return onlineResumeService.insertWork(workHistoryVO);
    }
    //新增项目经历
    @PostMapping("/addProject")
    @Operation(summary = "新增项目经历")
    public ResponseDTO addProject(@RequestBody ProjectHistoryVO projectHistoryVO){
        return onlineResumeService.insertProjectHistory(projectHistoryVO);
    }
    //新增教育背景
    @PostMapping("/addEdu")
    @Operation(summary = "新增教育背景")
    public ResponseDTO addEdu(@RequestBody EducationBackgroundVO educationBackgroundVO){
        return onlineResumeService.insertEducationBackground(educationBackgroundVO);
    }
    //删除教育背景
    @DeleteMapping("/deleteEdu/{educationBackgroundId}")
    @Operation(summary = "删除教育背景")
    @Parameters({
            @Parameter(name = "educationBackgroundId",description = "教育背景id",required = true,in = ParameterIn.QUERY)
    })
    public ResponseDTO deleteEdu(@PathVariable("educationBackgroundId") Integer educationBackgroundId){
        return onlineResumeService.deleteEducationBackground(educationBackgroundId);
    }

    //删除项目经历
    @Operation(summary = "删除项目经历")
    @Parameters({
            @Parameter(name = "projectHistoryId",description = "项目经历id",required = true,in = ParameterIn.QUERY)
    })
    @DeleteMapping("/deleteProject/{projectHistoryId}")
    public ResponseDTO deleteProject(@PathVariable("projectHistoryId") Integer projectHistoryId){
        return onlineResumeService.deleteProjectHistory(projectHistoryId);
    }

    //删除工作经历
    @DeleteMapping("/deleteWork/{workHistoryId}")
    @Operation(summary = "删除工作经历")
    @Parameters({
            @Parameter(name = "workHistoryId",description = "工作经历id",required = true,in = ParameterIn.QUERY)
    })
    public ResponseDTO deleteWork(@PathVariable("workHistoryId") Integer workHistoryId){
        return onlineResumeService.deleteWorkHistory(workHistoryId);
    }

    //修改工作经历
    @PostMapping("/updateWork")
    @Operation(summary = "修改工作经历")
    public ResponseDTO updateWork(@RequestBody List<WorkHistoryVO> workHistoryVO){
        return onlineResumeService.updateWorkHistory(workHistoryVO);
    }

    //修改教育经历
    @PostMapping("/updateEdu")
    @Operation(summary = "修改教育经历")
    public ResponseDTO updateEdu(@RequestBody List<EducationBackgroundVO> educationBackgroundVOS){
        return onlineResumeService.updateEducationBackground(educationBackgroundVOS);
    }
    //修改项目经历
    @PostMapping("/updateProject")
    @Operation(summary = "修改项目经历")
    public ResponseDTO updateProject(@RequestBody List<ProjectHistoryVO> projectHistoryVO){
        return onlineResumeService.updateProjectHistory(projectHistoryVO);
    }
    //查询工作经历
    @GetMapping("/selectWork")
    @Operation(summary = "查询工作经历")
    public ResponseDTO selectWork(WorkHistoryVO workHistoryVO){
        return onlineResumeService.selectWorkHistory(workHistoryVO);
    }
    //查询项目经历
    @GetMapping("/selectProject")
    @Operation(summary = "查询项目经历")
    public ResponseDTO selectProject(ProjectHistoryVO projectHistoryVO){
        return onlineResumeService.selectProjectHistory(projectHistoryVO);
    }
    //查询教育背景
    @GetMapping("/selectEduBack")
    @Operation(summary = "查询教育背景")
    public ResponseDTO selectEduBack(EducationBackgroundVO educationBackgroundVO){
        return onlineResumeService.selectEducationBackground(educationBackgroundVO);
    }
    //修改资格证书
    @PostMapping("/updateCertificates")
    @Operation(summary = "修改资格证书")
    public ResponseDTO updateCertificates(@RequestBody OnlineResumeVO onlineResumeVO){
        return onlineResumeService.updateCertificates(onlineResumeVO);
    }
    //查询用户的个人优势和资格证书
    @GetMapping("/selectUserAdvAndCer")
    @Operation(summary = "查询用户的个人优势和资格证书")
    public ResponseDTO selectUserAdvAndCer(OnlineResumeVO onlineResumeVO){
       return onlineResumeService.selectUserAdvantageAndCertificate(onlineResumeVO);
    }
    //修改用户优势
    @PostMapping("/updateAdvantage")
    @Operation(summary = "修改用户优势")
    public ResponseDTO updateAdvantage(@RequestBody OnlineResumeVO onlineResumeVO){
        return onlineResumeService.updateAdvantage(onlineResumeVO);
    }
    //修改用户工作状态
    @PostMapping("/updateJobStatus")
    @Operation(summary = "修改用户工作状态")
    public ResponseDTO updateJobStatus(@RequestBody UserVO userVO){
        return onlineResumeService.updateJobStatus(userVO);
    }
}
